#!/bin/bash

DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
UGLY_PYTHON_BIN="$DIR/../Frameworks/Python.framework/Versions/3.7/bin"
UGLY_SSL_CERT_DIR="$DIR/../Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/certifi"

# resolve ..-s in the path
PYTHON_BIN="$(cd "$UGLY_PYTHON_BIN" && pwd -P)"
export SSL_CERT_DIR="$(cd "$UGLY_SSL_CERT_DIR" && pwd -P)"
export SSL_CERT_FILE="$SSL_CERT_DIR/cacert.pem"

exec "$PYTHON_BIN/python3.7" -m thonny "$@"